//
//  AppDelegate.h
//  OpenTouch
//
//  Created by Bridger Maxwell on 4/2/08.
//  Copyright 2008 Fiery Ferret. All rights reserved.
//

#import <Cocoa/Cocoa.h>
#import <QTKit/QTKit.h>
#import "BlobDetection.h"
#import "VideoCIView.h"


@interface AppDelegate : NSObject {
	IBOutlet VideoCIView* outputView;
	IBOutlet NSPopUpButton* cameraList;
	
	QTCaptureDecompressedVideoOutput* decompressedVideoOutput;
	QTCaptureSession* session;
	QTCaptureDeviceInput* videoDeviceInput;
	NSArray* videoDevices;
	
	CIFilter* monoChromeFilter;	// Black and white filter
	CIFilter* smoothingFilter; //To kill noise
	CIFilter* colorCorrectionFilter;	// hue saturation brightness control through one CI filter
	CIFilter* backgroundFilter; // Uses Difference blend mode to filter out background
	BOOL needsNewBackground; //A flag that can be set to capture a new image
	int frameCount;
	
	blobDetection::BlobDetection* blobDetector;
	blobDetection::Blob* blob;
	float threshold;
	int dimMinX;
	int dimMinY;

}

- (NSArray *)videoDevices;
- (QTCaptureDevice *)selectedVideoDevice;
- (void)setSelectedVideoDevice:(QTCaptureDevice *)selectedVideoDevice;
- (IBAction)setNeedsNewBackground:(id)sender;
- (size_t)optimalRowBytesForWidth: (size_t)width bytesPerPixel: (size_t)bytesPerPixel;
- (void) drawBlobsOnCIImage:(CIImage *)image;


@property (readonly) CIFilter* colorCorrectionFilter;
@property (readonly) CIFilter* smoothingFilter;

@end
